#include "fan.h"
#include <wiringPi.h>

void fan_init()
{
    pinMode(FAN_GPIO_H, OUTPUT);
    pinMode(FAN_GPIO_L, OUTPUT);
}

// direction == 0 || direction == 1
void open_fan(int direction)
{
    if (direction == 0){
        digitalWrite(FAN_GPIO_H, HIGH);
        digitalWrite(FAN_GPIO_L, LOW);
    }else{
        digitalWrite(FAN_GPIO_H, LOW);
        digitalWrite(FAN_GPIO_L, HIGH);
    }
}

void close_fan()
{
    digitalWrite(FAN_GPIO_H, HIGH);
    digitalWrite(FAN_GPIO_L, HIGH);
}
